package com.thirteenClassics.enumeration;

import lombok.Getter;

@Getter
public enum ActionEnum {
    MARKACTION(2, "标注"),
    ENTRYACTION(1, "录入");

    private final long code;
    private final String name;

    ActionEnum(long code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ActionEnum getEnum(int code) {
        for (ActionEnum actionEnum : ActionEnum.values()) {
            if (actionEnum.getCode() == code) {
                return actionEnum;
            }
        }
        return null;
    }

    public static String getNameByCode(int code) {
        for (ActionEnum actionEnum : ActionEnum.values()) {
            if (actionEnum.getCode() == code) {
                return actionEnum.getName();
            }
        }
        return null;
    }
}
